import { __filename,getFileName } from "../utils/tools.js";

// import.meta.url 是指当前模块的元信息
let fileName=__filename(import.meta.url);

// 获取短文件名
let shortFileName=getFileName(fileName);


async function fn_getAll(ctx) {
    ctx.body = "获取所有用户";
}
async function fn_getById(ctx) {
    ctx.body = "获取指定id的用户";
}
async function fn_post(ctx) {
    ctx.body = "新增用户";
}
async function fn_put(ctx) {
    ctx.body = "修改用户";
}
async function fn_del(ctx) {
    ctx.body = "删除用户";
}

let obj = {};

obj[`get /${shortFileName}`] = fn_getAll;
obj[`get /${shortFileName}/:id?`] = fn_getById;
obj[`post /${shortFileName}`] = fn_post;
obj[`put /${shortFileName}/:id?`] = fn_put;
obj[`get /${shortFileName}/:id?`] = fn_del;

export default obj;

